<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>purecpp.cn - 中国最纯粹的 C++ 技术社区</title>
    <meta name="description" content="从2015年到2025年，从 C++11 到 C++26，只聊硬核技术，不水贴，不广告。">

    <!-- 本地 Pico CSS（确保路径正确） -->
    <link rel="stylesheet" href="css/pico.min.css">

    <!-- 本地 Font Awesome（确保路径正确） -->
    <link rel="stylesheet" href="font-awesome/css/all.min.css">
    <script defer src="script/alpine.js"></script>

    <style>
        :root {
            --primary: #4f46e5;
            --primary-hover: #4338ca;
            --border-color: #e2e8f0;
            --muted-color: #6b7280;
            /* 白天模式变量（默认） */
            --bg-page: #ffffff;
            --bg-hero: #d6def9;
            --bg-announcement: #e6ebff;
            --bg-card: #ffffff;
            --bg-search: #ffffff;
            --text-typing: #000000;
            --text-main: #333;
            --text-highlight: var(--primary);
        }

        /* 深色模式变量（统一合并，覆盖系统+手动切换） */
        :root.dark {
            --bg-page: #121212;
            --bg-hero: #1e2238;
            --bg-announcement: #2a2f4c;
            --bg-card: #1e1e1e;
            --bg-search: #2d2d2d;
            --text-typing: #f3f4f6;
            --text-main: #f3f4f6;
            --text-highlight: #818cf8;
            --logo-filter: invert(1) hue-rotate(180deg) brightness(1.8); /* logo反转调亮 */
        }

        /* 浅色模式变量（手动切换时覆盖） */
        :root.light {
            --logo-filter: none; /* 浅色模式不反转logo */
        }

        /* 核心布局：外层容器统一留白，内部模块满宽 */
        .page-wrapper, .footer-content {
            max-width: 1200px !important;
            width: 100% !important;
            padding: 0 1.5rem !important;
            margin: 0 auto !important;
        }

        /* 内部模块统一满宽无额外边距 */
        nav.container-fluid, .announcement, .hero, .card-section, .stats {
            max-width: 100% !important;
            width: 100% !important;
            margin: 0 !important;
            padding: 0 !important;
        }

        /* 导航栏样式 */
        nav.container-fluid ul:nth-child(2) {
            font-size: 0.85rem !important;
            margin-left: auto !important;
            margin-right: 0 !important;
        }
        nav .contrast {
            background: var(--primary) !important; /* 与Hero区域注册按钮背景色一致 */
            border-color: var(--primary) !important;
            color: white !important; /* 文字色保持白色，确保对比 */
        }
        nav .contrast:hover {
            background: var(--primary-hover) !important; /* 复用hover深色，与Hero区域一致 */
            border-color: var(--primary-hover) !important;
        }
        .hero .contrast {
            padding: 0.5rem 1rem !important;
            font-size: 0.9rem;
            background: var(--primary) !important; /* 与导航栏注册按钮背景色一致 */
            border-color: var(--primary) !important;
            color: white !important; /* 文字色保持白色，确保对比 */
        }
        .hero .contrast:hover {
            background: var(--primary-hover) !important; /* 复用hover深色，与导航栏一致 */
            border-color: var(--primary-hover) !important;
        }

        /* Logo 样式（合并精简） */
        nav .secondary img {
            background-color: transparent !important;
            filter: var(--logo-filter, none) !important;
            width: 36px !important;
            height: 36px !important;
            vertical-align: middle !important;
        }
        nav .secondary strong {
            font-size: 20px !important;
            color: var(--primary) !important;
        }

        /* Hero 区域 */
        .hero {
            border-radius: 10px !important;
            overflow: hidden !important;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05) !important;
            background: var(--bg-hero) !important;
            padding: 1rem 0 !important;
            text-align: center !important;
            margin-bottom: 1rem !important;
        }
        .hero h1, .hero p {
            color: white !important;
            margin: 0 auto 0.5rem !important;
            max-width: 100% !important;
        }
        .hero .lead {
            color: var(--text-typing) !important;
            font-size: 0.9rem !important;
            line-height: 1.8 !important;
            font-family: "JetBrains Mono", "Fira Code", Consolas, "Courier New", monospace !important;
            font-weight: 400 !important;
        }
        .hero .slogan-highlight {
            font-size: 1.1rem !important;
            font-weight: 600 !important;
            color: var(--primary) !important;
            letter-spacing: 0.05em !important;
        }
        .hero .contrast {
            padding: 0.5rem 1rem !important;
            font-size: 0.9rem !important;
        }
        .hero-section {
            color: var(--text-highlight) !important;
        }

        /* 打字机效果（保留核心，删除重复） */
        .typing-container {
            display: inline-flex;
            align-items: flex-start;
            gap: 4px;
            overflow: hidden;
        }
/* 打字文本：统一动画参数，确保打字节奏一致 */
.typing-text {
    display: inline-block;
    overflow: hidden;
    white-space: nowrap;
    width: 0;
    color: var(--text-typing) !important;
    caret-color: transparent !important; /* 隐藏默认光标（解决双重光标） */
    animation: typing 2s steps(35, end) forwards; /* 步长35，打字更平滑 */
}

.typing-text.line1 { animation-delay: 0.5s; } /* 初始延迟0.5s，不突兀 */
.typing-text.line2 { animation-delay: 2.8s; } /* line1结束+过渡，衔接自然 */

/* 光标：严格跟随打字节奏，打字时显示，不打字时隐藏 */
.typing-cursor {
    color: var(--primary) !important;
    font-weight: bold;
    font-size: 0.9rem !important;
    opacity: 0; /* 初始隐藏 */
    /* line1光标：与line1打字同时显示，打字结束后立即消失 */
    animation: 
        show-cursor 0s 0.5s forwards, /* 0.5s时（line1开始打字）显示光标 */
        blink 1s step-end infinite 0.5s, /* 同步闪烁 */
        fade-out 0s 2.5s forwards; /* 2.5s时（line1打字结束）隐藏光标 */
}

.typing-cursor.line2-cursor {
    opacity: 0; /* 初始隐藏 */
    /* line2光标：与line2打字同时显示，打字结束后立即消失 */
    animation: 
        show-cursor 0s 2.8s forwards, /* 2.8s时（line2开始打字）显示光标 */
        blink 1s step-end infinite 2.8s, /* 同步闪烁 */
        fade-out 0s 5s forwards; /* 5s时（line2打字结束）隐藏光标 */
}

/* 核心动画：打字、光标闪烁、显示/隐藏 */
@keyframes typing { from { width: 0; } to { width: 100%; } }
@keyframes blink { from, to { opacity: 1; } 50% { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; visibility: hidden; } }
@keyframes show-cursor { to { opacity: 1; } }

        /* 公告栏 */
        .announcement {
            font-size: 14px !important;
            background: var(--bg-announcement) !important;
            border-radius: 10px !important;
            padding: 0.3rem !important;
            margin: 0.5rem 0 !important;
        }
        .announcement-row {
            display: grid;
            grid-template-columns: 1fr auto;
            gap: 1rem;
            align-items: center;
        }
        .announcement-container {
            position: relative;
            overflow: hidden;
            height: 24px;
        }
        .announcement-scroll {
            animation: scroll-up 15s linear infinite;
        }
        .announcement-scroll:hover { animation-play-state: paused; }
        .announcement-item {
            height: 24px;
            display: flex;
            align-items: center;
            color: var(--text-main) !important;
        }
        .announcement-item strong { color: var(--text-highlight) !important; }
        @keyframes scroll-up {
            0%,20% { transform: translateY(0); }
            25%,45% { transform: translateY(-24px); }
            50%,70% { transform: translateY(-48px); }
            75%,95% { transform: translateY(-72px); }
            100% { transform: translateY(0); }
        }

        /* 搜索框 */
        .search-box {
            position: relative;
            min-width: 300px;
            height: 36px;
        }
        .search-box input {
            border: 1px solid var(--border-color) !important;
            border-radius: 4px !important;
            margin: 0 !important;
            padding: 0.375rem 2rem 0.375rem 0.5rem !important;
            font-size: 0.85rem !important;
            background: var(--bg-search) !important;
            width: 100% !important;
            height: 100% !important;
            box-sizing: border-box !important;
        }
        .search-icon {
            position: absolute;
            right: 0.75rem;
            top: 50%;
            transform: translateY(-50%);
            color: var(--muted-color);
            font-size: 0.8rem;
            cursor: pointer;
            transition: all 0.2s ease;
            padding: 0.25rem;
            border-radius: 3px;
        }
        .search-icon:hover {
            color: var(--primary);
            background: rgba(79, 70, 229, 0.1);
            transform: translateY(-50%) scale(1.1);
        }

        /* 卡片区域 */
        .card-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
            gap: 1rem !important;
            margin: 0 !important;
            padding: 0 !important;
            width: 100% !important;
        }
        .card {
            border: 1px solid var(--border-color);
            border-radius: 8px;
            padding: 1rem !important;
            background: var(--bg-card) !important;
            transition: all 0.3s ease;
            min-height: 150px;
            display: flex;
            flex-direction: column;
            margin: 0 !important;
        }
        .card:hover {
            transform: translateY(-2px);
            box-shadow: 0 5px 15px rgba(0,0,0,0.1);
            border-color: var(--primary);
        }
        .card h3 {
            color: var(--text-highlight) !important;
            margin-bottom: 0.5rem !important;
            display: flex;
            align-items: center;
            gap: 0.5rem;
            font-size: 1rem;
        }
        .card p {
            line-height: 1.4;
            font-size: 0.85rem;
            flex-grow: 1;
            margin-bottom: 0.5rem !important;
            color: var(--text-main) !important;
        }
        .feature-icon {
            font-size: 1.1rem;
            color: var(--primary);
        }
        .card small {
            color: var(--primary) !important;
            display: flex;
            align-items: center;
            gap: 0.5rem;
            margin-top: auto;
            font-size: 0.75rem;
        }

        /* 数据统计 */
        .stats {
            background: var(--bg-card) !important;
            padding: 1rem 0 !important;
            margin: 1rem 0 !important;
            border-radius: 10px !important;
            box-shadow: 0 1px 3px rgba(0,0,0,0.05);
        }
        .stats-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
            gap: 1rem;
            text-align: center;
            padding: 0 1rem !important;
        }
        .stat-number {
            font-size: 1.5rem;
            font-weight: bold;
            color: var(--text-highlight) !important;
            display: block;
            margin-bottom: 0.2rem !important;
        }
        .stats-grid div { color: var(--text-main) !important; }

        /* 通用标题 */
        section h2 {
            margin-bottom: 1rem !important;
            text-align: center;
            color: var(--text-highlight) !important;
        }

        /* 页脚 */
        footer {
            margin-top: 1.5rem !important;
            padding: 1.5rem 0 !important;
            border-top: 1px solid var(--border-color);
            background: var(--bg-page) !important;
        }
        .footer-grid {
            display: grid;
            align-items: center !important;
            justify-content: center !important;
            gap: 2rem !important;
            grid-template-columns: auto auto auto !important;
            width: 100% !important;
        }
        .footer-content p {
            margin: 0 !important;
            font-size: 0.8rem !important;
            color: var(--muted-color) !important;
            line-height: 1 !important;
        }
        .footer-content ul {
            display: flex;
            gap: 1.2rem;
            list-style: none;
            padding: 0 !important;
            margin: 0 !important;
            align-items: center;
            line-height: 1 !important;
        }
        .footer-content a {
            font-size: 0.8rem !important;
            color: var(--muted-color) !important;
            text-decoration: none !important;
            line-height: 1 !important;
        }
        .footer-content a:hover { color: var(--primary) !important; }

        /* 社交链接 */
        .footer-content .fa-weixin, .footer-content .fa-github {
            font-size: 1.1rem !important;
            color: var(--text-highlight) !important;
            line-height: 1 !important;
        }
        .footer-content .wechat-link {
            display: flex !important;
            align-items: center !important;
            gap: 0.4rem !important;
        }

        /* 主题切换按钮（精简合并，删除冲突样式） */
        .theme-toggle {
            display: flex !important;
            align-items: center !important;
            gap: 0.6rem !important;
            font-size: 0.8rem !important;
            color: var(--muted-color) !important;
            margin-left: 1rem !important;
            line-height: 1 !important;
        }
        .toggle-switch {
            position: relative !important;
            display: inline-block !important;
            width: 44px !important;
            height: 24px !important;
            cursor: pointer !important;
        }
        .toggle-switch input {
            opacity: 0 !important;
            width: 0 !important;
            height: 0 !important;
        }
        .toggle-slider {
            position: absolute !important;
            top: 0 !important;
            left: 0 !important;
            right: 0 !important;
            bottom: 0 !important;
            background-color: #bbb !important;
            border-radius: 24px !important;
            transition: background-color 0.3s ease !important;
            border: 1px solid #999 !important;
        }
        .toggle-slider > span {
            position: absolute !important;
            left: 2px !important;
            bottom: 2px !important;
            width: 18px !important;
            height: 18px !important;
            background-color: white !important;
            border-radius: 50% !important;
            transition: left 0.3s ease !important;
            box-shadow: 0 1px 3px rgba(0,0,0,0.2) !important;
            z-index: 1 !important;
        }
        .fa-sun, .fa-moon {
            position: absolute !important;
            top: 50% !important;
            transform: translateY(-50%) !important;
            font-size: 12px !important;
            transition: opacity 0.3s ease !important;
            z-index: 2 !important;
        }
        .fa-sun {
            left: 8px !important;
            color: #4f46e5 !important;
        }
        .fa-moon {
            right: 8px !important;
            color: #fff !important;
        }
        /* 主题切换状态（合并精简） */
        #themeToggleBtn:checked + .toggle-slider {
            background-color: #333 !important;
        }
        #themeToggleBtn:checked + .toggle-slider > span {
            left: 24px !important;
        }
        #themeToggleBtn:checked + .toggle-slider .fa-sun,
        #themeToggleBtn:not(:checked) + .toggle-slider .fa-moon {
            opacity: 0 !important;
        }
        #themeToggleBtn:checked + .toggle-slider .fa-moon,
        #themeToggleBtn:not(:checked) + .toggle-slider .fa-sun {
            opacity: 1 !important;
        }

        /* 响应式适配（精简合并） */
        @media (max-width: 992px) {
            .footer-grid {
                grid-template-columns: 1fr !important;
                gap: 1.5rem !important;
                text-align: center !important;
            }
            .theme-toggle { margin-left: 0 !important; justify-content: center !important; }
            .announcement-row { grid-template-columns: 1fr !important; gap: 0.5rem !important; }
            .search-box { min-width: 100% !important; }
            .page-wrapper, .footer-content { padding: 0 1rem !important; }
        }
        @media (max-width: 768px) {
            .typing-text { animation: typing 1.8s steps(25, end) forwards !important; }
            .typing-text.line2 { animation-delay: 1.8s !important; }
            .typing-cursor.line2-cursor {
                animation: show-cursor 0s 1.8s forwards, blink 1s step-end infinite 1.8s, fade-out 0s 3.6s forwards !important;
            }
        }

        /* 全局body背景 */
        body {
            background-color: var(--bg-page) !important;
            color: var(--text-main) !important;
        }
    </style>
</head>

<body>
    <!-- 外层包裹器：统一留空白，所有内部模块满宽 -->
    <div class="page-wrapper">
        <!-- 导航栏 -->
        <nav class="container-fluid">
            <ul>
                <li>
                    <a href="/" class="secondary">
                        <img src="http://purecpp.cn/purecpp/images/cover/logo6.png" alt="PureCpp Logo">
                        <strong>PureCpp</strong>
                    </a>
                </li>
            </ul>
            <ul>
                <li><a href="#articles">技术文章</a></li>
                <li><a href="#qa">问答</a></li>
                <li><a href="#chat">聊天室</a></li>
                <li><a href="#review">Code Review</a></li>
                <li><a href="#conference">Purecpp大会</a></li>
                <li><a href="login.html">登录</a></li>
                <li><a href="register.html" role="button" class="contrast" style="padding: 0.3rem 0.5rem !important; font-size: 0.85rem !important; height: auto !important;">注册</a></li>
            </ul>
        </nav>

        <!-- 公告栏 -->
        <article class="announcement">
            <div class="announcement-row">
                <div class="announcement-container">
                    <div class="announcement-scroll">
                        <div class="announcement-item">
                            <strong><i class="fas fa-bullhorn"></i> 最新公告：</strong>
                            PureCpp 2025 大会即将开始，敬请期待！
                        </div>
                        <div class="announcement-item">
                            <strong><i class="fas fa-code"></i> 技术动态：</strong>
                            C++26 新特性专栏连载中：Modules / Coroutines / Reflection
                        </div>
                        <div class="announcement-item">
                            <strong><i class="fas fa-users"></i> 社区招募：</strong>
                            招募版主 3 名 • 熟悉现代 C++ 且每周能上线 10h+
                        </div>
                    </div>
                </div>

                <div class="search-box">
                    <input type="text" placeholder="搜索技术文章、问答...">
                    <i class="fas fa-search search-icon" onclick="performSearch()"></i>
                </div>
            </div>
        </article>

        <!-- 主要内容 -->
        <main>
            <!-- Hero 区域：满宽，与card完全对齐 -->
            <section class="hero">
                <h2 class="hero-section">中国最纯粹的现代C++社区</h2>
                <p class="lead">
                    <span class="slogan-highlight">Newer is Better!</span> <br>
                    <span class="typing-container">
                        <span class="typing-cursor">|</span>
                        <span class="typing-text line1"><strong>从2015 年至今，从 C++11 到 C++26</strong></span>
                    </span>
                    <br>
                    <span class="typing-container">
                        <span class="typing-cursor line2-cursor">|</span>
                        <span class="typing-text line2"><strong>专注于现代C++ 新技术、开源项目、技术交流和问答的平台。</strong></span>
                    </span>
                </p>
                <a href="register.html" role="button" class="contrast">
                    <i class="fas fa-user-plus"></i>
                    立即免费注册
                </a>
            </section>

            <!-- 6个功能卡片：满宽，与hero完全对齐 -->
            <section class="card-section">
                <div class="card-grid">
                    <article class="card">
                      <div style="display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem !important;">
                        <div class="feature-icon">
                            <i class="fas fa-lightbulb"></i>
                        </div>
                        <h3>技术文章</h3>
                      </div>
                      <p>聚焦最新的C++技术、最佳技术实践；发现、贡献或启动您的下一个开源项目。</p>
                      <small><i class="fas fa-sync-alt"></i> 每周更新</small>
                    </article>

                    <article class="card">
                      <div style="display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem !important;">
                        <div class="feature-icon">
                            <i class="fas fa-question-circle"></i>
                        </div>
                        <h3>问答</h3>
                      </div>
                      <p>遇到技术难题？在这里提问，获得社区专家的快速、高质量解答。</p>
                      <small><i class="fas fa-check-circle"></i> 98% 3天内解决</small>
                    </article>

                    <article class="card">
                      <div style="display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem !important;">
                        <div class="feature-icon">
                            <i class="fas fa-comments"></i>
                        </div>
                        <h3>C++ 聊天室</h3>
                      </div>
                      <p>实时讨论技术话题，建立连接，享受轻松的社区生活。</p>
                      <small><i class="fas fa-users"></i> 在线 1.2k 人</small>
                    </article>

                    <article class="card">
                      <div style="display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem !important;">
                        <div class="feature-icon">
                            <i class="fas fa-calendar-alt"></i>
                        </div>
                        <h3>Purecpp 大会</h3>
                      </div>
                      <p>定期举办线上/线下技术分享会，学习最新技术趋势。</p>
                      <small><i class="fas fa-edit"></i> 进行中</small>
                    </article>

                    <article class="card">
                       <div style="display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem !important;">
                        <div class="feature-icon">
                            <i class="fas fa-code"></i>
                        </div>
                        <h3>Code Review</h3>
                       </div>
                       <p>提交您的代码，接受同行评审，提升代码质量和最佳实践。</p>
                       <small><i class="fas fa-chart-bar"></i> 127 次审查</small>
                    </article>

                    <article class="card">
                       <div style="display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem !important;">
                        <div class="feature-icon">
                            <i class="fas fa-hands-helping"></i>
                        </div>
                        <h3>社区服务</h3>
                       </div>
                       <p>招聘、内推、项目组队，我们致力于推动C++技术生态发展。</p>
                       <small><i class="fas fa-star"></i> 为程序员服务</small>
                    </article>
                </div>
            </section>

            <!-- 数据统计：与hero、card对齐 -->
            <section class="stats">
                <div class="stats-grid">
                    <div>
                        <span class="stat-number">42,687</span>
                        <div>注册会员</div>
                    </div>
                    <div>
                        <span class="stat-number">3,856</span>
                        <div>技术文章</div>
                    </div>
                    <div>
                        <span class="stat-number">28,493</span>
                        <div>已解决问题</div>
                    </div>
                    <div>
                        <span class="stat-number">1,2000+</span>
                        <div>参会人数</div>
                    </div>
                </div>
            </section>
        </main>
    </div>

    <!-- 页脚 -->
<footer>
    <div class="footer-content">
        <div class="footer-grid">
            <!-- 左列：版权信息 -->
            <div style="text-align: center;">
                <p>© 2025 PureCpp.cn 京ICP备 2025xxxx号</p>
            </div>

            <!-- 中列：导航链接 + 主题按钮 -->
            <div>
                <ul>
                    <li><a href="/about">关于我们</a></li>
                    <li><a href="/rules">社区守则</a></li>
                    <li><a href="/contact">联系我们</a></li>
                    <li><a href="/links">友情链接</a></li>
                    <!-- 主题切换按钮 -->
                    <li class="theme-toggle">
                        <span>主题切换</span>
                        <label class="toggle-switch">
                            <input type="checkbox" id="themeToggleBtn">
                            <span class="toggle-slider">
                                <span></span>
                                <i class="fas fa-sun"></i>
                                <i class="fas fa-moon"></i>
                            </span>
                        </label>
                    </li>
                </ul>
            </div>

            <!-- 右列：微信公众号 + GitHub -->
            <div style="display: flex; align-items: center; gap: 1.5rem;">
                <a href="#" title="微信公众号" class="wechat-link">
                    <i class="fab fa-weixin"></i>
                </a>
                <a href="#" title="GitHub">
                    <i class="fab fa-github"></i>
                </a>
            </div>
        </div>
    </div>
</footer>

<!-- 核心脚本 -->
<script>
// 1. 搜索功能
function performSearch() {
    const input = document.querySelector('.search-box input');
    const keyword = input.value.trim();
    keyword ? alert(`搜索关键词：${keyword}（实际项目中替换为搜索接口）`) : alert('请输入搜索关键词');
}

// 2. 主题切换逻辑（精简后）
const themeToggleBtn = document.getElementById('themeToggleBtn');
const THEME_STORAGE_KEY = 'purecpp_theme';
const htmlRoot = document.documentElement;

// 初始化主题
function initTheme() {
    const savedTheme = localStorage.getItem(THEME_STORAGE_KEY);
    const isDarkMode = savedTheme === 'dark' || (!savedTheme && window.matchMedia('(prefers-color-scheme: dark)').matches);
    themeToggleBtn.checked = isDarkMode;
    htmlRoot.classList.add('manual-theme');
    htmlRoot.classList.toggle('dark', isDarkMode);
    htmlRoot.classList.toggle('light', !isDarkMode);
}

// 切换主题
function toggleTheme() {
    const isDarkMode = themeToggleBtn.checked;
    htmlRoot.classList.toggle('dark', isDarkMode);
    htmlRoot.classList.toggle('light', !isDarkMode);
    localStorage.setItem(THEME_STORAGE_KEY, isDarkMode ? 'dark' : 'light');
}

// 初始化 + 绑定事件
initTheme();
themeToggleBtn.addEventListener('change', toggleTheme);
</script>
</body>
</html>